import { defineStore } from 'pinia'

export const useAppStore = defineStore('app', {
  state: () => ({
    collapsed: false,
    layout: 'normal',
  }),
  actions: {
    switchCollapsed() {
      this.collapsed = !this.collapsed
    },
    setCollapsed(b) {
      this.collapsed = b
    },
    setLayout(v) {
      this.layout = v
    },
  },
  persist: {
    key: 'app',
    storage: localStorage,
  },
})
